<?php
//我的任务
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return['set']=$this->plugin_setting('basic');
$return['setting']=$this->plugin_setting('basic');
if($_RQ['op']=='main'){
	if(isset($_RQ['status'])){
		$status=intval($_RQ['status']);
		$return['status']=$_RQ['status'];
	}else{
		$status=1;
		$return['status']=1;
	}
	$condition = '';
	$time0 = '\'0000-00-00 00:00:00\'';

		switch ($status) {
		case 1:
			$condition = ' and (stoptime > "' . date('Y-m-d H:i:s') . '" or stoptime = ' . $time0 . ') and finishtime = ' . $time0;
			break;

		case 2:
			$condition = ' and finishtime > ' . $time0 . '';
			break;

		case 3:
			$condition = ' and stoptime != "0000-00-00 00:00:00" and stoptime < \'' . date('Y-m-d H:i:s') . '\' and finishtime = ' . $time0;
			break;

	/*	default:
			header('location:' . mobileUrl('task.mine', array('status' => 1)));
			exit();
	*/
		}

		$sql = 'select * from ' . tablename('jy_renwu_task_record') . ' where mid = :mid and uniacid = :uniacid ' . $condition . ' order by id desc';
		$list = pdo_fetchall($sql, array(':mid' => $_SESSION['uid'], ':uniacid' => $_SESSION['uniacid']));
		set_html('title','我的任务');

	$return['list']=$list;
	$return['status']=$status;
	exi($return);
}
